package practice4;

import java.util.Scanner;

public class P2299 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] a=new int[100001];
        int[] sum=new int[100001];      //记录各个深度的权值和
        int deep=0;
        for(int i=1;i<=n;i++){
            a[i]=sc.nextInt();
            int level= (int)(Math.log(i)/Math.log(2))+1;       //第几层
            sum[level]+=a[i];
            deep=level;
        }
        int ans=0;
        int max=0;
        for(int i=1;i<=deep;i++){
            if(sum[i]>max){
                max=sum[i];
                ans=i;
            }
        }
        System.out.println(ans);
    }
}
